package person.bing.fbcloud;

import com.ulisesbocchio.jasyptspringboot.encryptor.DefaultLazyEncryptor;
import org.springframework.core.env.StandardEnvironment;

/**
 * @author: mengfanbing
 * @date: 2020/12/2 15:12
 */
public class JasyptUtilBing {
    public static void main(String[] args) {
        util();
    }

    //NcU6V27y1Bi46QihU7h1IPkZXlVnsGejQw5wPCCCuNfQe+MqtIfK7/BIS4D8X3he
    public static void util(){
        System.setProperty("jasypt.encryptor.password","bing");
        //加密工具
        DefaultLazyEncryptor defaultLazyEncryptor = new DefaultLazyEncryptor(new StandardEnvironment());
        //明文密码
        String plaintext = "123123";
        //加密
        String ciphertext = defaultLazyEncryptor.encrypt(plaintext);
        System.out.println(plaintext + "加密后: " + ciphertext);
        //解密 过程
        String pText = defaultLazyEncryptor.decrypt(ciphertext);
        System.out.println(ciphertext + "解密后: " + pText);
    }
}
